package cn.stronglink.suite.core;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSON;

import cn.stronglink.asset.message.mq.topic.entity.Collect24gSender;
import cn.stronglink.asset.message.mq.topic.entity.CollectInfo;
import cn.stronglink.asset.model.ReaderInfo;

public class Test {

	public static void main(String[] args) {
		//盘点
		List<ReaderInfo> list = new ArrayList<ReaderInfo>();
		ReaderInfo a1 = new ReaderInfo();
		a1.setIp("192.178.0.1");
		a1.setReaderTime(200);
		list.add(a1);
		ReaderInfo a2 = new ReaderInfo();
		a2.setIp("192.178.0.1");
		a2.setReaderTime(200);
		list.add(a2);
		ReaderInfo a3 = new ReaderInfo();
		a3.setIp("192.178.0.1");
		a3.setReaderTime(200);
		list.add(a3);
		
		List<CollectInfo> resultList = new ArrayList<CollectInfo>();
		if(list!=null&&list.size()>0) {
			for(ReaderInfo info:list) {
				Integer readerTime = info.getReaderTime();
				String ip =info.getIp();
				Map<String, Object> temp = new HashMap<String, Object>();
				temp.put("readerTime", readerTime);
				CollectInfo dataInfo = new CollectInfo();
				dataInfo.setDevIp(ip);
				dataInfo.setDatas(temp);
				resultList.add(dataInfo);
			}
		}
		Collect24gSender reader = new Collect24gSender();
		reader.setActioncode("reader002");
		reader.setAwsPostData(resultList);
		System.out.println(JSON.toJSONString(reader)); 
		
	}

}
